package org.liquidByte.simpleChat.guiClient;

import java.io.IOException;
import java.util.List;

import org.liquidByte.simpleChat.communication.AbstractClient;
import org.liquidByte.simpleChat.communication.Channel;
import org.liquidByte.simpleChat.communication.CommunicationException;
import org.liquidByte.simpleChat.dto.Message;
import org.liquidByte.simpleChat.dto.User;
import org.liquidByte.simpleChat.dto.UserIdentification;

public class ChatClient extends AbstractClient{
	protected ChatClient(Channel channel) {
		super(channel);
	}	
	
	public UserIdentification login(User user) throws IOException, CommunicationException {
		return(UserIdentification)(this.call("chat/login", user));
	}
	public void setStatus(User user) throws IOException, CommunicationException {
		this.call("chat/setStatus", user);
	}
	public void logoff() throws IOException, CommunicationException {
		this.call("chat/logoff");
	}
	public void sendMessage(Message msg) throws IOException, CommunicationException {
		this.call("chat/sendMessage", msg);
	}
	@SuppressWarnings("unchecked")
	public List<User> getOnlineList() throws IOException, CommunicationException {
		return (List<User>)this.call("chat/getOnlineList");
	}
}
